package se.liu.oschi129.world.model;

/**
 * This is a class containing all physical rules in the world (gravity, friction, maximal falling speed).
 * 
 * @author oschi129
 */
public class WorldPhysicalRules implements Cloneable {
	
	private double gravity, maxFallSpeed, friction;
	
	/**
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 * - - - - - - - - - - - - Constructors - - - - - - - - - - - 
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 */
	
	public WorldPhysicalRules(double gravity, double maxFallSpeed, double friction) {
		this.gravity = gravity;
		this.maxFallSpeed = maxFallSpeed;
		this.friction = friction;
	}
	
	public WorldPhysicalRules() {
		gravity = 1.5;
		maxFallSpeed = 10;
		friction = 1;
	}
	
	/**
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 * - - - - - - - - - - Public methods - - - - - - - - - - - 
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 */
	
	/** Sets the gravity */
	public void setGravity(double gravity) {
		this.gravity = gravity;
	}
	
	/** Returns the gravity */
	public double getGravity() {
		return gravity;
	}
	
	/** Sets the maximal falling speed */
	public void setMaxFallSpeed(double maxFallSpeed) {
		this.maxFallSpeed = maxFallSpeed;
	}
	
	/** Returns the maximal falling speed */
	public double getMaxFallSpeed() {
		return maxFallSpeed;
	}
	
	/** Sets the friction */
	public void setFriction(double friction) {
		this.friction = friction;
	}
	
	/** Returns the friction */
	public double getFriction() {
		return friction;
	}
	
	/** Returns a clone of the physical rules */
	public WorldPhysicalRules clone() {
		return new WorldPhysicalRules(getGravity(), getMaxFallSpeed(), getFriction());
	}

}
